package com.client.eurekaclient.controller;

import com.netflix.ribbon.proxy.annotation.Http;
import org.apache.catalina.servlet4preview.http.HttpServletRequest;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Enumeration;

@RestController
public class MyController {

    @RequestMapping(value = "/info", method = RequestMethod.GET)
    public String info(HttpServletRequest request) {
        Enumeration<String> headNames = request.getHeaderNames();
        while (headNames.hasMoreElements()){
            String name = headNames.nextElement();
            System.out.println(name + ":" + request.getHeader(name) + ";");
        }
        return "hello I am is spring-serviceB"; //测试代码直接返回一个字符串，不再调用service层等等。
    }

}
